package com.bjpowernode.crm.commons.utils;

import java.util.Date;
import java.text.SimpleDateFormat;

public class DateUtils {

    /**
     * 将时间格式改为yyyy-MM-dd HH:mm:ss
     * @param date
     * @return
     */
    public static String formateDataTime(Date date){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dateStr = sdf.format(date);
        return dateStr;
    }
    /**
     * 将时间格式改为yyyy-MM-dd
     * @param date
     * @return
     */
    public static String formateData(Date date){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String dateStr = sdf.format(date);
        return dateStr;
    }
    /**
     * 将时间格式改为HH:mm:ss
     * @param date
     * @return
     */
    public static String formateTime(Date date){
        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
        String dateStr = sdf.format(date);
        return dateStr;
    }
}
